package com.util;

import java.io.PrintWriter;

import javax.servlet.http.HttpServletResponse;


/**
 * 将后台处理完的结果写回前端页面,如jsp页面;
 * 或者可用于在ajax异步调用后台方法,该方法处理完相应业务逻辑之后将结果返回,这个结果即通过这个工具类实现
**/
public class ResponseUtil {

    public static void write(HttpServletResponse response,Object o)throws Exception{
        response.setContentType("text/html;charset=utf-8");
        PrintWriter out=response.getWriter();
        out.println(o.toString());
        out.flush();
        out.close();
    }
}
